import itertools

def main():
    A=[]
    t = input().split(" ")
    for tt in t:
        A.append(int(tt))
    d = [0 for i in range(len(A))]
    dmax = 0
    for i in range(len(A)) :
        d[i] = 0
        temp = int(A[i])
        while temp!=0:
            d[i] = d[i] + 1
            temp = temp//10
        if dmax < d[i] :
            dmax = d[i]
    B = [[] for _ in range(dmax)]
    for j in range(dmax) :
        B[j] = []
    for i in range(len(A)) :
        B[d[i]-1].append(A[i])
    for j in range(dmax) :
        #radix_sort(B[j],j+1)
        print(radix_sort(B[j],j+1))

def radix_sort(A,n):
    k = 0
    B = [[] for _ in range(0, 10)]

    max_len = n
    while k < max_len:
        for i in range(0, len(A)):
            k_digit = int((A[i] / 10 ** k) % 10)
            B[k_digit].append(A[i])
        # print(B)
        A = list(itertools.chain(*B))
        B = [[] for _ in range(0, 10)]
        k += 1
    return A

if __name__=='__main__':
    main()
